﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Site.Models.Message>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Messages reçus</h2>

                    <%= Ajax.ActionLink("Boite de réception", "MessagesPartial", 
                    new {type="received"},
                new AjaxOptions{
                    UpdateTargetId = "MessagesPartial",
                    
                    InsertionMode= InsertionMode.Replace
                    
                    
                }) %>
                    <%= Ajax.ActionLink("Boite d'envoi", "MessagesPartial", new { type = "sent" },
                new AjaxOptions{
                    UpdateTargetId = "MessagesPartial",
                    
                    InsertionMode= InsertionMode.Replace
                    
                    
                }) %>       
                <p>
    <%: Html.ActionLink("Nouveau", "SendMessage") %>
</p>      
	
		<div id="MessagesPartial">

    <table>
        <tr>
            <th>
                Sender
            </th>
            <th>
                Subject
            </th>
            <th>
                SentDate
            </th>
            <th>
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%: Html.DisplayFor(modelItem => item.Sender) %>
            </td>
            <td>
                <%: Html.ActionLink(item.Subject, "ReadMessage", new { id= item.MessageId})%>
            </td>
            <td>
                <%: Html.DisplayFor(modelItem => item.SentDate) %>
            </td>
            <td>
                <%: Html.ActionLink("Supprimer", "Delete", new { id=item.MessageId }) %>
            </td>
        </tr>
        <% } %>
    </table>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="alerts" runat="server">
</asp:Content>
